package com.angel.webapp.application;

import com.angel.common.keyValue.KeyValueResult;
import com.angel.common.keyValue.impl.KeyValueResultImpl;
import com.angel.io.processors.commands.imports.ImportFileProcessorCommand;

/**
 * @author William
 * @since 03/February/2009
 */
public class ApplicationImportFileCommands {

    private static ApplicationImportFileCommands INSTANCE;

    private KeyValueResult keyValueResult;

    private ApplicationImportFileCommands(){
        super();
        this.setKeyValueResult(new KeyValueResultImpl());
    }

    public synchronized static ApplicationImportFileCommands createInstance(){
        if(INSTANCE == null){
            INSTANCE = new ApplicationImportFileCommands();
        }
        return INSTANCE;
    }

    public KeyValueResult getKeyValueResult() {
        return keyValueResult;
    }

    public void setKeyValueResult(KeyValueResult keyValueResult) {
        this.keyValueResult = keyValueResult;
    }

    public ImportFileProcessorCommand findImportFileCommand(String name){
        return (ImportFileProcessorCommand) this.keyValueResult.getResultFor(name);
    }
    
    public void removeImportFileCommand(String name){
        this.keyValueResult.removeKeyValue(name);
    }
    
    public void addImportFileCommand(String name, ImportFileProcessorCommand importFileProcessorCommand){
        this.keyValueResult.addKeyValue(name, importFileProcessorCommand);
    }

    public boolean containsImportFileCommand(String name){
        return this.keyValueResult.containsResultFor(name);
    }
}